<!DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8">
    <title>开发者中心</title>
    <link rel="stylesheet" type="text/css" href="/static/css/base.css">
    <link href="/static/images/logo.svg" rel="Shortcut Icon">
  </head>
  <body>
    <div id="app"></div>
    <script>
      // 以下变量由 webpack 构建工具填充
      // var RELEASE_VERSION = '<%= JSON.stringify(htmlWebpackPlugin.options) %>'

      // 环境变量
      var APP_VERSION = '<%= process.env.BK_APP_VERSION %>'
      var BACKEND_URL = `<%= process.env.BK_PAAS3_BACKEND_URL %>` || `<%= process.env.BK_PAAS3_URL %>/backend`
      var NODE_ENV = '<%= process.env.NODE_ENV %>'
      var BK_LESSCODE_URL = '<%= process.env.BK_LESSCODE_URL %>' || ''
      var BK_PAAS2_URL = '<%= process.env.BK_PAAS2_URL %>' || ''
      var BK_DOCS_URL_PREFIX = '<%= process.env.BK_DOCS_URL_PREFIX %>' || ''
      var BK_APIGW_URL = '<%= process.env.BK_APIGW_URL %>' || ''
      var BK_APIGW_DOC_URL = '<%= process.env.BK_APIGW_DOC_URL %>' || ''
      var BK_COMPONENT_API_URL = '<%= process.env.BK_COMPONENT_API_URL %>' || ''
      var BK_ANALYSIS_JS = '<%= process.env.BK_ANALYSIS_JS %>' || ''
      var DOCS_URL_PREFIX = `<%= process.env.BK_DOCS_URL_PREFIX %>/markdown/PaaS/DevelopTools/BaseGuide`
      var BK_STATIC_URL = '<%= process.env.BK_STATIC_URL %>' || ''
      var BK_PAAS_VERSION = '<%= process.env.BK_PAAS_VERSION %>' || ''
      var GLOBAL_CONFIG = {
        APP_VERSION: '<%= process.env.BK_APP_VERSION %>',
        LOGIN_SERVICE_URL: '<%= process.env.BK_LOGIN_URL %>',
        USERS_URL: `<%= process.env.BK_COMPONENT_API_URL %>/api/c/compapi/v2/usermanage/fs_list_users/` || '',
      }
      var BKPAAS_BUILD_VERSION = decodeURIComponent('<%= process.env.BK_PAAS_BUILD_VERSION %>' || '')

      // 控制台输出版本信息
      if (BKPAAS_BUILD_VERSION !== '') {
        console.log(
          `%c版本信息%c${ BKPAAS_BUILD_VERSION }%c >> ${new Date().toString().slice(0, 16)}<<`,
          'padding: 2px 5px; background: #ea3636; color: #fff; border-radius: 3px 0 0 3px;',
          'padding: 2px 5px; background: #42c02e; color: #fff; border-radius: 0 3px 3px 0; font-weight: bold;',
          'background-color: #3A84FF; color: #fff; padding: 2px 5px; border-radius: 3px; font-weight: bold;margin-left: 16px;',
        );
      }
    </script>
    <% if (process.env.BK_APP_VERSION === 'te'){ %>
    <!-- BK Analytics start -->
    <!-- start及end之间的内部代码会在企业版本出包时删除 -->
    <script>
      document.write('<scr'+'ipt src="'+BK_ANALYSIS_JS+'"></scr'+'ipt>');
      document.addEventListener('DOMContentLoaded', () => {
        const analysisScript = document.createElement('script');
        analysisScript.src = BK_ANALYSIS_JS;
        document.body.appendChild(analysisScript);
      });
      GLOBAL_CONFIG.USERS_URL = ''
    </script>
    <% if (process.env.NODE_ENV !== 'development') { %>
    <script>
        if (window.NODE_ENV !== 'development') {
          if(BKANALYSIS) {
            BKANALYSIS.init({
              // siteName 是网站的唯一标识，请不要修改
              siteName: 'custom:paasv3cli:default:default',
            })
          }
        }
    </script>
    <% } %>
    <!-- End BK Analytics end -->
    <% } %>
  </body>
</html>
